package com.example.securitydemo.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by Guaguaerhao on 2021/4/25 00:20
 */
@Configuration
@RequiredArgsConstructor
public class AliConfig {

    private final AppProperties appProperties;

    @Bean
    public IAcsClient iAcsClient() {
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",
                appProperties.getAli().getAppKey(),
                appProperties.getAli().getAppSecret());
        return new DefaultAcsClient(profile);
    }
}
